export default {
  namespaced: true,
  state: {
    userInfo: sessionStorage.getItem( 'userInfo' ) ? JSON.parse( sessionStorage.getItem( 'userInfo' ) ) : {}
  },
  getters: {
    getUname ( state ) {
      return state.userInfo.uname ? state.userInfo.uname : "来宾";
    }
  },
  actions: {
    // 处理异步的请求，如调用接口

    userInfoAc ( { commit }, payload ) {
      commit( "userInfoMt", payload )
    }
  },
  mutations: {

    userInfoMt ( state, payload ) {
      state.userInfo = payload;
    }
  }
}